<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>作用域插槽</title>
</head>
<body>
<div id="app">
    <cpn></cpn>

    <hr>

    <!--scope 为自定义的标识符，-->
    <cpn v-slot="scope">
        <div>{{ scope }}</div>
    </cpn>

    <hr>

    <cpn v-slot="scope">
        <div>{{ scope.message }}</div>
    </cpn>

</div>

<template id="cpn">
    <h1>Hello, World!</h1>
    <slot message="Hello, Vue">

    </slot>
    <h2>欢迎来到陕西交通职业技术学院</h2>
</template>

<script type="module">
    import {createApp, defineComponent} from "../../../js/vue.esm-browser.js";

    let component = defineComponent(
        {
            template:"#cpn",
        }
    );

    let app = createApp(
        {
            setup() {
                return {}
            }
        }
    );

    app.component("cpn", component)
    app.mount("#app")
</script>
</body>
</html>